﻿namespace StyleCop.For.ReSharper.TestProject.Documentation
{
    #region Using Directives

    using System;
    using System.Collections.Generic;
    using System.Threading;

    #endregion

    /// <summary>
    /// If this is documented here it will be copied into the file header.
    /// </summary>
    public class Test1600ElementsMustBeDocumented<TA, TB>
    {
        [Serializable]
        public enum TestEnum
        {
        }

        #region Constants and Fields

        private const string testConst = "testConst";

        /// <summary>
        /// Stores the lock used to read and write the cache.
        /// </summary>
        private static readonly ReaderWriterLock Lock = new ReaderWriterLock();

        private readonly Dictionary<string, string> reportServerProperties;

        private string testField;

        #endregion

        #region Constructors

        public Test1600ElementsMustBeDocumented(string arg1)
        {
        }

        public Test1600ElementsMustBeDocumented(TA a, TB b)
        {

        }

        public Test1600ElementsMustBeDocumented(TA a, TB b, Test1600ElementsMustBeDocumented<TA, TB> c)
        {

        }

        public class GenericException<T,S> : Exception
        {
        }
        
        public Test1600ElementsMustBeDocumented(string cache, string persistence, string studioRightsService)
        {
            this.reportServerProperties = this.reportServerProperties;

            if (persistence.Length > 10)
            {
                throw new ArgumentException("Hello");
            }

            if (persistence == null)
            {
                throw new ArgumentNullException("persistence");
            }

            throw new GenericException<int>();
        }

        /// <summary>
        /// Changes the value of the <see cref="Example"/> <see cref="DependencyProperty"/>
        /// <see cref="Example"/> has a space after the closing of the see tag.
        ///</summary>
        public void TestMethod4()
        {
        }

        /// <inheritdoc />
        public Test1600ElementsMustBeDocumented(Dictionary<string, string> reportServerProperties)
        {
            this.reportServerProperties = reportServerProperties;
        }

        public Test1600ElementsMustBeDocumented(int reportServerProperties)
        {
            this.testField = reportServerProperties.ToString();
        }

        #endregion

        #region Delegates

        /// <inheritdoc />
        public delegate void ButtonEventHandler(object source, int count);

        #endregion

        #region Events

        public event ButtonEventHandler ButtonClick;

        #endregion

        #region Public Properties and Indexers

        public bool Enabled { get; set; }

        /// This doc summary is missing the opening summary tag to test we don't crash.
        /// </summary>
        public bool Enabled2 { get; set; }

        public bool EnabledReadOnly { get; private set; }

        public string TestProperty
        {
            get
            {
                return this.testField + testConst;
            }

            set
            {
                if (value != null)
                {
                    this.testField = value;
                }
            }
        }

        public string TestPropertyWithNoValueDoc { get; set; }

        /// <summary>
        /// Gets or sets the test property with no value doc.
        /// </summary>
        /// <value>
        /// Test Value.
        /// </value>
        public string TestPropertyWithValueDoc { get; set; }

        #endregion

        #region Public Methods

        public bool TestMethod()
        {
            return true;
        }

        /// <summary>
        /// An awesome struct.
        /// </summary>
        public struct MyStruct
        {
            /// <summary>
            /// An empty instance of the struct.
            /// </summary>
#pragma warning disable 649
            public static readonly MyStruct Empty;
#pragma warning restore 649
        }

        /// <summary>
        /// </summary>
        /// <returns>
        /// True if specified.
        /// </returns>
        public bool TestMethod2()
        {
            return true;
        }

        #endregion
    }
}